GitHub

Parameters

The GitHub notification service changes commit status using GitHub Apps and requires specifying the following settings:

  • appID - the app id
  • installationID - the app installation id
  • privateKey - the app private key
  • enterpriseBaseURL - optional URL, e.g. https://git.example.com/

Configuration

  1. Create a GitHub Apps using https://github.com/settings/apps/new
  2. Change repository permissions to enable write commit statuses and/or deployments 2
  3. Generate a private key, and download it automatically 3
  4. Install app to account
  5. Store privateKey in argocd-notifications-secret Secret and configure GitHub integration in argocd-notifications-cm ConfigMap
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: <config-map-name>
  5. data:
  6. service.github: |
  7. appID: <app-id>
  8. installationID: <installation-id>
  9. privateKey: $github-privateKey
  1. apiVersion: v1
  2. kind: Secret
  3. metadata:
  4. name: <secret-name>
  5. stringData:
  6. github-privateKey: |
  7. -----BEGIN RSA PRIVATE KEY-----
  8. (snip)
  9. -----END RSA PRIVATE KEY-----
  1. Create subscription for your GitHub integration
  1. apiVersion: argoproj.io/v1alpha1
  2. kind: Application
  3. metadata:
  4. annotations:
  5. notifications.argoproj.io/subscribe.<trigger-name>.github: ""

Templates

GitHub - 图3

  1. template.app-deployed: |
  2. message: |
  3. Application {{.app.metadata.name}} is now running new version of deployments manifests.
  4. github:
  5. repoURLPath: "{{.app.spec.source.repoURL}}"
  6. revisionPath: "{{.app.status.operationState.syncResult.revision}}"
  7. status:
  8. state: success
  9. label: "continuous-delivery/{{.app.metadata.name}}"
  10. targetURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
  11. deployment:
  12. state: success
  13. environment: production
  14. environmentURL: "https://{{.app.metadata.name}}.example.com"
  15. logURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
  16. requiredContexts: []

Notes: - If the message is set to 140 characters or more, it will be truncated. - If github.repoURLPath and github.revisionPath are same as above, they can be omitted.